package com.attilax.nlp.segment;

import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.function.Consumer;

import org.apache.commons.io.FileUtils;
import org.apache.log4j.Logger;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.TextField;

import com.attilax.Charset.EncodingDetect;
import com.attilax.core.ForeachFunction;
import com.attilax.io.DirTraveService;
import com.attilax.web.es.esUtil_docx2;

public class lyricParse {
	static final Logger logger = Logger.getLogger(esUtil_docx2.class);

	public static void main(String[] args) {
		String dir = "D:\\000atibek\\lev5 ati ext notbek0\\music lyric zip";
		new DirTraveService().traveV5_vS522(new File(dir), new ForeachFunction() {

			@Override
			public void each(int count, final File f) throws Exception {

				String code = EncodingDetect.getJavaEncode(f.getAbsolutePath());
				final String t = FileUtils.readFileToString(f, code);
				logger.info("cn:" + count + f.getAbsolutePath());
				File file=new File("c:\\tmp\\lyricsWords4.txt");
				 new ik(). seg(t, new Consumer<String>() {
					
					@Override
					public void accept(String t) {
						try {
							FileUtils.writeStringToFile(file, t+"\r\n", true);
						} catch (Exception e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						}
						
					}
				});
			
			
				 
				// kw="成年 后世";
				// final String addParams_json = json4es(f, t);

				// logger.info(r);

			}

		});
		System.out.println("--f");

	}
}
